<?
    class Principio_Model_Company
    {
        private $id;
        private $type;
        private $pool_id;
        private $caption;
        private $proxy;
        private $global_template;
        private $ext_template;
        private $vlan;
        private $vlan_pc;
        private $default_gw;
        private $netname;
        private $netmask;
        private $broadcast;
        private $range_from;
        private $range_to;
        private $ip;

        const TYPE_COMPANY = 1;
        const TYPE_POOL = 2;
        const TYPE_COMPANY_IN_POOL = 3;


        public function __construct(&$values = null)
        {
            if (is_null($values))
            {
                $this->id = -1;
                $this->type = -1;
                $this->pool_id = -1;
                $this->caption = "";
                $this->proxy = "";
                $this->global_template = "";
                $this->ext_template = "";
                $this->vlan = -1;
                $this->vlan_pc = -1;
                $this->default_gw = "";
                $this->netname = "";
                $this->netmask = "";
                $this->broadcast = "";
                $this->range_from = "";
                $this->range_to = "";
                $this->ip = "";
            }
            else
            {
                $this->id = (isset($values['id']) ? $values['id'] : -1);
                $this->type = $values['type'];
                $this->pool_id = $values['pool_id'];
                $this->caption = $values['caption'];
                $this->proxy = $values['proxy'];
                $this->global_template = $values['global_template'];
                $this->ext_template = $values['ext_template'];
                $this->vlan = $values['vlan'];
                $this->vlan_pc = $values['vlan_pc'];
                $this->default_gw = $values['default_gw'];
                $this->netname = $values['netname'];
                $this->netmask = $values['netmask'];
                $this->broadcast = $values['broadcast'];
                $this->range_from = $values['range_from'];
                $this->range_to = $values['range_to'];
                $this->ip = $values['ip'];
            };
        }


        public function getID()
        {
            return $this->id;
        }


        public function setID($id)
        {
            $id_ = intval($id);
            if ($id_ < 1)
                return false;

            $this->id = $id_;
            return $this;
        }


        public function getType()
        {
            return $this->type;
        }


        public function setType($type)
        {
            $type_ = intval($type);
            if (($type_< 1) || ($type_ > 5))
                return false;

            $this->type = $type_;
            return $this;
        }


        public function getOwnerPoolID()
        {
            return $this->pool_id;
        }

        public function getPoolID()
        {
            return ($this->isCompany() ? -1 : $this->getId());
        }

        public function setPoolID($pool_id)
        {
            $pool_id_ = intval($pool_id);
            if ($pool_id_ < 1)
                return false;

            $this->pool_id = $pool_id_;
            return $this;
        }


        public function getCompanyID()
        {
            return ($this->isPool() ? -1 : $this->getId());
        }


        public function getCaption()
        {
            return $this->caption;
        }


        public function setCaption($caption)
        {
            $this->caption = $caption;
            return $this;
        }


        public function getProxy()
        {
            return $this->proxy;
        }


        public function setProxy($proxy)
        {
            $this->proxy = $proxy;
            return $this;
        }


        public function getGlobalTemplate()
        {
            return $this->global_template;
        }

        public function setGlobalTemplate($global_template)
        {
            $this->global_template = $global_template;
            return $this;
        }


        public function getExtTemplate()
        {
            return $this->ext_template;
        }


        public function setExtTemplate($ext_template)
        {
            $this->ext_template = $ext_template;
            return $this;
        }


        public function getVlanID()
        {
            return $this->vlan;
        }


        public function setVlanId($vlan_id)
        {
            $vlan_id_ = intval($vlan_id);
            if ($vlan_id_ < -1)
                return false;

            $this->vlan = $vlan_id_;
            return $this;
        }

        public function getVlanPcID()
        {
            return $this->vlan_pc;
        }


        public function setVlanPcId($vlan_pc_id)
        {
            $vlan_pc_id_ = intval($vlan_pc_id);
            if ($vlan_pc_id_ < -1)
                return false;

            $this->vlan_pc = $vlan_pc_id_;
            return $this;
        }


        public function getDefaultGw()
        {
            return $this->default_gw;
        }


        public function setDefaultGw($default_gw)
        {
            $this->default_gw = $default_gw;
            return $this;
        }


        public function getNetmask()
        {
            return $this->netmask;
        }


        public function setNetmask($netmask)
        {
            $this->netmask = $netmask;
            return $this;
        }


        public function getNetname()
        {
            return $this->netname;
        }


        public function setNetname($netname)
        {
            $this->netname = $netname;
            return $this;
        }


        public function getBroadcast()
        {
            return $this->broadcast;
        }


        public function setBroadcast($broadcast)
        {
            $this->broadcast = $broadcast;
            return $this;
        }

        public function getRangeFrom()
        {
            return $this->range_from;
        }

        public function setRangeFrom($range_from)
        {
            $this->range_from = $range_from;
            return $this;
        }

        public function getRangeTo()
        {
            return $this->range_to;
        }


        public function setRangeTo($range_to)
        {
            $this->range_to = $range_to;
            return $this;
        }


        public function getIP()
        {
            return $this->ip;
        }


        public function setIP($ip)
        {
            $this->ip = $ip;
            return $this;
        }


        public function isPool()
        {
            return ($this->getType() == 2);
        }


        public function isCompanyInPool()
        {
            return ($this->getType() == 3);
        }


        public function isCompanyNotInPool()
        {
            return ($this->getType() == 1);
        }


        public function isCompany()
        {
            return (!$this->isPool());
        }
    }
?>